//
//  DesignModelViewController.m
//  UIComprehensive
//
//  Created by lanou3g on 16/1/27.
//  Copyright © 2016年 徐强. All rights reserved.
//

#import "DesignModelViewController.h"
//遵循协议
@interface DesignModelViewController ()<MyDelegate>

@end

@implementation DesignModelViewController

-(void)loadView{
    self.rootV = [[DesignView alloc]initWithFrame:([UIScreen mainScreen].bounds)];
    self.view = self.rootV;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //两种方法都是为了实现高内聚、低耦合的理念
    //targetAction模式进行实现
    [self.rootV.targetButton addMyTarget:self action:@selector(targetAction:)];
    //代理实现
    self.rootV.delegateButton.delegate = self;
}
//实现代理方法
-(void)changeColor:(DelegateFunc *)delegate{
    self.rootV.delegateButton.backgroundColor = [UIColor blueColor];
}

- (void)targetAction:(TargetAction *)sender{
    self.rootV.targetButton.backgroundColor = [UIColor blackColor];
}


@end
